package com.joe.test_mybatis_plus.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Joe
 * @description 测试用户
 * @time 2023/3/3 15:05
 **/
@Data
@ApiModel(value = "测试用户")
public class TestUser {
    @ApiModelProperty(value = "ID")
    private Long id;

    @Min(value = 1,message = "性别必须在指定范围")
    @Max(value = 2,message = "性别必须在指定范围")
    @ApiModelProperty(value = "性别 1 男， 2 女 ", required = true, example = "1")
    private Integer sex;

    @NotBlank(message = "中文姓名不能为空")
    @Length(min = 2,max = 4, message = "中文姓名长度必须在2到4个字符之间")
    @Pattern(regexp = "^[\\u4E00-\\u9FA5]{2,4}$", message = "中文姓名必须使用中文")
    @ApiModelProperty(value = "中文姓名", required = true, example = "陆新红")
    private String chineseName;

    @NotBlank(message = "英文姓名不能为空")
    @ApiModelProperty(value = "英文名称", required = true, example = "joe")
    @Length(min = 2,max = 15, message = "英文姓名长度必须在2到15个字符之间")
    @Pattern(regexp = "[a-zA-Z]+", message = "英文姓名必须使用英文字符")
    private String englishName;

    //@Range(min = 1, max = 100, message = "年龄必须在{min}和{max}之间")
    @Range(min = 1, max = 100, message = "100005")
    @ApiModelProperty(value = "年龄",required = true, example = "20")
    private Integer age;

    @Email(message = "邮箱格式错误")
    @ApiModelProperty(value = "邮箱",required = true, example = "xinhong@qq.com")
    private String email;

    @Pattern(regexp = "^1(3|4|5|7|8)\\d{9}$", message = "手机号码格式错误")
    @ApiModelProperty(value = "手机号",required = true, example = "17691279016")
    private String phone;

    @Range(min = 0, max = 1000, message = "财产值必须在{min}和{max}之间")
    @ApiModelProperty(value = "财产值",required = true, example = "20")
    private BigDecimal money;

    @ApiModelProperty(value = "生日", example = "1990-09-19 10:00:00")
    @Past(message = "生日必须是过去的")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date birthday;

    @ApiModelProperty(value = "计划时间",example = "2023-09-19 10:00:00")
    @Future(message = "计划时间必须是未来的时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date planTime;
    @ApiModelProperty(value = "爱好", example = "[11,22]")
    @NotEmpty(message = "爱好不得为空")
    private List<Long> love;
}
